package com.maxatime.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.maxatime.dao.ExamStorage3Mapper;
import com.maxatime.pojo.entity.ExamStorage3;
import com.maxatime.service.Ssbkaoshi6;

@Service
public class SsbkaoshiImpl6 implements Ssbkaoshi6{
	
	@Autowired
	ExamStorage3Mapper examStorage3Mapper;

	@Override
	public int deleteByPrimaryKey(Integer pkId) {
		// TODO Auto-generated method stub
		examStorage3Mapper.deleteByPrimaryKey(pkId);
		
		return 0;
	}

	@Override
	public int insert(ExamStorage3 record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertSelective(ExamStorage3 record) {
		// TODO Auto-generated method stub
		ExamStorage3 examStorage3 = new ExamStorage3();
		BeanUtils.copyProperties(record, examStorage3);
		Date d = new Date();
		examStorage3.setCreateTime(d);
		examStorage3.setUpdateTime(d);
		examStorage3.setRemark("0");
		examStorage3Mapper.insertSelective(examStorage3);
		return 0;
	}

	@Override
	public ExamStorage3 selectByPrimaryKey(Integer pkId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updateByPrimaryKeySelective(ExamStorage3 record) {
		// TODO Auto-generated method stub
		ExamStorage3 examStorage3 = new ExamStorage3();
		BeanUtils.copyProperties(record, examStorage3);
		Date d = new Date();
		examStorage3.setUpdateTime(d);
		examStorage3Mapper.updateByPrimaryKeySelective(examStorage3);
		return 0;
	}

	@Override
	public int updateByPrimaryKey(ExamStorage3 record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Map<String, Object> list(ExamStorage3 examStorage3) {
		// TODO Auto-generated method stub
		
		PageHelper.startPage(examStorage3.getPageNum(), examStorage3.getPageSize());
		List<ExamStorage3> listDemo = examStorage3Mapper.list(examStorage3);
		PageInfo<ExamStorage3> pageInfo = new PageInfo<ExamStorage3>(listDemo);
		Map<String, Object> m = new HashMap<String, Object>();
		m.put("list", listDemo);
		m.put("pageInfo", pageInfo);
		return m;
	}

	@Override
	public ExamStorage3 find(int pkId) {
		// TODO Auto-generated method stub
		return examStorage3Mapper.find(pkId);
	}

}
